package com.riguz.forks.framework.mvc;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.riguz.forks.framework.Framework;

public class ContainerListener implements ServletContextListener {
    private static final Logger logger = LoggerFactory.getLogger(ContainerListener.class);
    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
        logger.info("Container destroyed");
        Framework.getPluginLoader().stopPlugins();
    }

    @Override
    public void contextInitialized(ServletContextEvent arg0) {
        logger.info("Container initialized");
        Framework.getPluginLoader().registerPlugins();
        Framework.getPluginLoader().startPlugins();
    }

}
